package com.huawei.appmarket.service.externalapi.actions;

import android.os.AsyncTask.Status;
import com.huawei.appmarket.service.externalapi.jumpers.AppLinkActionJumper;
import com.huawei.appmarket.service.externalapi.jumpers.CommonActionJumper;
import com.huawei.appmarket.service.externalapi.jumpers.HiAppActionJumper;
import com.huawei.appmarket.service.externalapi.jumpers.HiAppLinkActionJumper;
import com.huawei.appmarket.service.externalapi.jumpers.HttpLinkActionJumperEx;
import com.huawei.appmarket.service.externalapi.jumpers.HttpShareLinkActionJumper;
import com.huawei.appmarket.service.externalapi.jumpers.SearchActionJumper;
import com.huawei.appmarket.service.externalapi.jumpers.VmallLinkActionJumper;
import o.AsyLoader;
import o.dpb;
import o.dys.a;

public class AppViewAction extends ViewAction {
    protected static final String HOST_APPGALLERY_CLOUD = "appgallery.cloud.huawei.com";
    private static final String HOST_APPMARKET = "com.huawei.appmarket";
    private static final String HOST_APPMARKET_APPLINK = "com.huawei.appmarket.applink";
    private static final String HOST_DETAILS = "details";
    private static final String HOST_KIDS = "com.huawei.appmarket.kids";
    private static final String HOST_SEARCH = "search";
    private static final String HOST_VMALL = "a.vmall.com";
    private static final String PREFIX_AG = "/ag";
    private static final String PREFIX_MARKET_SHARE = "/marketshare/app";
    private static final String SCHEME_APPMARKET = "appmarket";
    private static final String SCHEME_HIAPP = "hiapp";
    private static final String SCHEME_HIAPPLINK = "hiapplink";
    private static final String SCHEME_HTTP = "http";
    private static final String SCHEME_HTTPS = "https";
    private static final String SCHEME_KIDS = "kids";
    private static final String SCHEME_MARKET = "market";
    private int delayCount = 1;
    private String openStr = "";
    private AsyLoader task;

    public AppViewAction(a aVar) {
        super(aVar);
    }

    protected void registerViewActionJumpers() {
        super.registerViewActionJumpers();
        registerJumper(SCHEME_APPMARKET, HOST_DETAILS, CommonActionJumper.class);
        registerJumper(SCHEME_MARKET, HOST_SEARCH, SearchActionJumper.class);
        registerJumper(SCHEME_APPMARKET, HOST_SEARCH, SearchActionJumper.class);
        registerJumper(SCHEME_MARKET, HOST_APPMARKET_APPLINK, AppLinkActionJumper.class);
        registerJumper(SCHEME_HTTP, HOST_APPGALLERY_CLOUD, PREFIX_MARKET_SHARE, HttpShareLinkActionJumper.class);
        registerJumper(SCHEME_HTTPS, HOST_APPGALLERY_CLOUD, PREFIX_MARKET_SHARE, HttpShareLinkActionJumper.class);
        registerJumper(SCHEME_HTTP, HOST_APPGALLERY_CLOUD, PREFIX_AG, HttpLinkActionJumperEx.class);
        registerJumper(SCHEME_HTTPS, HOST_APPGALLERY_CLOUD, PREFIX_AG, HttpLinkActionJumperEx.class);
        registerJumper(SCHEME_HTTPS, HOST_VMALL, VmallLinkActionJumper.class);
        registerJumper(SCHEME_HIAPP, HOST_APPMARKET, HiAppActionJumper.class);
        registerJumper(SCHEME_HIAPPLINK, HOST_APPMARKET, HiAppLinkActionJumper.class);
        registerJumper(SCHEME_KIDS, HOST_KIDS, HiAppActionJumper.class);
    }

    public void onDestroy() {
        cancelTask();
    }

    public void cancelTask() {
        if (this.task != null) {
            this.task.ˎ(true);
            this.task = null;
        }
    }

    public boolean onTimeout() {
        if (this.task != null && (this.task.getStatus() == Status.RUNNING || this.task.getStatus() == Status.PENDING)) {
            cancelTask();
            dpb.ˏ(this.callback, this.openStr);
        }
        return true;
    }
}
